package com.baiyang.server.model.system;

import java.util.Comparator;
import java.util.stream.Collectors;

import com.baiyang.server.annotation.NotNull;

/**
 * @author XVX - generator
 * @version 1
 */
@NotNull
public class Menu extends Tree<Menu>{
	//唯一id
	@NotNull
	private String id;
	//菜单名称
	@NotNull
	private String name;
	private String type;
	//菜单现实顺序
	private Integer showIndex;
	// 路由
	private String path;
	//Unknown
	private String createTime;
	//创建人
	@NotNull
	private String createBy;
	private String createName;
	//是否有效：1-有效，0-无效
	private String available = "1";
	//是否删除：1-删除，0-不删除
	private String del = "0";
	public String getCreateName() {
		return createName;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public void setCreateName(String createName) {
		this.createName = createName;
	}
	public String getId(){
		return id;
	}
	public void setId(String id){
		this.id = id;
	}
	public String getName(){
		return name;
	}
	public void setName(String name){
		this.name = name;
	}
	public Integer getShowIndex(){
		return showIndex;
	}
	public void setShowIndex(Integer showIndex){
		this.showIndex = showIndex;
	}
	public String getCreateTime(){
		return createTime;
	}
	public void setCreateTime(String createTime){
		this.createTime = createTime;
	}
	public String getCreateBy(){
		return createBy;
	}
	public void setCreateBy(String createBy){
		this.createBy = createBy;
	}
	public String getAvailable(){
		return available;
	}
	public void setAvailable(String available){
		this.available = available;
	}
	public String getDel(){
		return del;
	}
	public void setDel(String del){
		this.del = del;
	}
	public String getPath() {
		return path;
	}
	public void setPath(String path) {
		this.path = path;
	}

	@Override
	public void sorted() {
		setChildrens(getChildrens().stream().sorted(Comparator.comparing(Menu::getShowIndex)).collect(Collectors.toList()));
	}
}
